﻿using SqlSugar;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace YY.Admin.Services.Service.Org
{
    public class SysOrgService : ISysOrgService, ISingletonDependency
    {
        private readonly ISqlSugarClient _dbContext;
        public  SysOrgService(ISqlSugarClient dbContext) {
            _dbContext=dbContext;
        }
        public async Task<List<long>> GetChildIdListWithSelfById(long pid)
        {
            var orgTreeList = await _dbContext.Queryable<SysOrg>().ToChildListAsync(u => u.Pid, pid, true);
            return orgTreeList.Select(u => u.Id).ToList();
        }
    }
}
